package com.autonavi.yunda.yunji.core.utils;

import org.springframework.util.CollectionUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author cizhong.wcs
 * @date 2022/8/9 11:19
 */
public class SqlUtil {
    public static String inArrayWithQuoteCondition(List<String> array) {
        if (CollectionUtils.isEmpty(array)) {
            return "()";
        }
        return "(" + array.stream().map(s -> "'" + s + "'").collect(Collectors.joining(",")) + ")";
    }

    public static String inArrayCondition(List<Object> array) {
        if (CollectionUtils.isEmpty(array)) {
            return "()";
        }
        return "(" + array.stream().map(Object::toString).collect(Collectors.joining(",")) + ")";
    }
}
